#include <bits/stdc++.h>
using namespace std;
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
using ll = long long;
void solve()
{
    ll n,q=0;
    cin >> n;
    ll now;
    for(ll i=1;i<=n;i++)
    {
        if(q+(i+1) >n)
            break;
        q+=i;
        now = i;
    }
    cout << now << endl;
    now--;
    cout << q << endl;
}
int main()
{
    int t = 1;
   // cin >> t;
    while(t--)
    {
        solve();
    }
   return 0;
}
